package cn.tradewin.pmp.select.model;

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.OptionGroupModel;
import org.apache.tapestry5.OptionModel;
import org.apache.tapestry5.internal.OptionModelImpl;
import org.apache.tapestry5.util.AbstractSelectModel;

import cn.tradewin.pmp.persist.model.MDept;

public class DeptSelectModel extends AbstractSelectModel {

	private final List<MDept> depts;
	
	public DeptSelectModel(List<MDept> depts) {
		this.depts = depts;
	}
	
	
	@Override
	public List<OptionGroupModel> getOptionGroups() {
		return null;
	}

	@Override
	public List<OptionModel> getOptions() {
		List<OptionModel> options = new ArrayList<OptionModel>();
		for (MDept dept : depts) {
			options.add(new OptionModelImpl(dept.getDeptName(), dept.getDeptNo()));
		}
		return options;
	}

}
